Skip to content

[db/models] Remove duplicate unique-prx constraint on pull_requests#3717

Closed
devs6186 wants to merge 1 commit intoaugurlabs:mainfrom
devs6186:fix/3192-pr-duplicate-constraint
Closed

[db/models] Remove duplicate unique-prx constraint on pull_requests#3717
devs6186 wants to merge 1 commit intoaugurlabs:mainfrom
devs6186:fix/3192-pr-duplicate-constraint

Conversation

@devs6186
Copy link
Copy Markdown

@devs6186 devs6186 commented Feb 18, 2026

Changeset

  • Remove the redundant UniqueConstraint("repo_id", "pr_src_id", name="unique-prx") from the PullRequest model

Notes

The pull_requests table had two identical constraints: unique-pr and unique-prx, both on (repo_id, pr_src_id). The insert in bulk_insert_dicts uses ON CONFLICT (pr_url) which targets pull-request-insert-unique. When a PR conflicts on unique-prx instead, the ON CONFLICT clause does not catch it, resulting in an unhandled IntegrityError. Removing the duplicate declaration stops new installs from creating it. A companion migration to DROP CONSTRAINT "unique-prx" on existing databases should follow.

Related issues/PRs

Description

  • Removed duplicate unique-prx constraint declaration from PullRequest model

This PR fixes #3712

Notes for Reviewers
The model change alone is not enough for existing deployments — a DROP CONSTRAINT migration will be needed. Noting this for the follow-up.

Signed commits

  • Yes, I signed my commits.

Fixes augurlabs#3192

- The pull_requests table declared two identical UniqueConstraint
  entries on (repo_id, pr_src_id): "unique-pr" and "unique-prx"
- ON CONFLICT (pr_url) in bulk_insert_dicts only catches conflicts on
  "pull-request-insert-unique"; conflicts on "unique-prx" bypass the
  upsert handler and surface as uncaught IntegrityErrors
- Drop the redundant "unique-prx" declaration from the model
- A companion Alembic migration is needed to DROP CONSTRAINT "unique-prx"
  on existing databases

Signed-off-by: devs6186 <devyanshsomvanshi@gmail.com>
@MoralCode MoralCode linked an issue Feb 18, 2026 that may be closed by this pull request
@MoralCode
Copy link
Copy Markdown
Collaborator

This has already been addressed by #3713, which is essentially already ready to merge. Closing as duplicate

@MoralCode MoralCode closed this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove duplicate unique-prx constraint from pull requests table

2 participants